(()=> {
    $('#add_address').validate({
        rules: {        //验证规则
            adname: {     //设置naem的验证
                required: true,
                rangelength:[2,10]
            },
            admobile:{
                required: true,
                mobile:true
            },
            adareacode:{
                required: true,
                number:true
            },
            adress:{
                required: true,
                rangelength:[5,30]
            }
        },
        submitHandler: function(form) {//提交事件
            layer.load(1);
            $.post(DUSER+'/update_address',$('#add_address').serialize(),function (da) {
                var index = parent.layer.getFrameIndex(window.name);//获取自身iframe
                parent.layer.close(index);  //执行关闭
            })
        }
    })

    //点击关闭
    $('#close').click(function () {
        var index = parent.layer.getFrameIndex(window.name);//获取自身iframe
        parent.layer.close(index);  //执行关闭
    });

})();

